/* INCLUDES ******************************************************************/

#include "ses_common.h"
#include "ses_led.h"
#include "ses_button.h"

// button wiring on SES board
#define BUTTON_ROTARY_PORT		PORTB
#define BUTTON_ROTARY_PIN		6
#define BUTTON_JOYSTICK_PORT	PORTB
#define BUTTON_JOYSTICK_PIN		7

/* FUNCTION DEFINITION *******************************************************/

/**button demo application using polling
 */
int main(void) {
	button_init();
	led_greenInit();
	led_redInit();
	led_yellowInit();

	while (1) {
		if ((PIN(BUTTON_ROTARY_PORT) >> BUTTON_ROTARY_PIN) & 1) {// read the status of the port of the button and shift it 6 times to right
			// then AND 0000001 we got the value of the pin , if it is set to 1 then green else red
	        led_greenOff();
		} else {
            led_greenOn();


		}

	}

	return 0;
}
